package cn.websocket.pojo.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * <h3>WebSocket</h3>
 * <p>
 *     白名单限制规则
 * </p>
 *
 * @author gdw
 * @since 2025-08-20 11:16:47
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "rate-limiter")
public class RateLimiterProperties {

    private List<Rule> rules;

    @Data
    public static class Rule {
        private String path;     // 路径前缀
        private int capacity;    // 桶容量
        private int refill;      // 每次补充多少
        private String duration; // 补充周期 (例如 "1m", "30s", "1h")
    }
}
